<?php

namespace App\Http\Requests\API;

use App\Models\Item;
use InfyOm\Generator\Request\APIRequest;

class UpdateItemAPIRequest extends APIRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required_without_all:logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract|between:2,50',
            'logo' => 'required_without_all:name,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'regtime' => 'required_without_all:name,logo,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract|date',
            'country' => 'required_without_all:name,logo,regtime,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'state_id' => 'required_without_all:name,logo,regtime,country,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'state' => 'required_unless:state_id,0',
            'state_name' => 'required_unless:state_id,0',
            'county_id' => 'required_without_all:name,logo,regtime,country,state_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'county' => 'required_unless:county_id,0',
            'county_name' => 'required_unless:county_id,0',
            'zip_id' => 'required_without_all:name,logo,regtime,country,state_id,county_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'zip_code' => 'required_unless:zip_id,0',
            'zip' => 'required_unless:zip_id,0',
            'zip_name' => 'required_unless:zip_id,0',
            'address' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'introduction' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'business' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'brokerage' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract',
            'web_url' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract|url',
            'legal_person' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,salesman_name,salesman_phone,salesman_wechat,salesman_duty,contract|between:1,20',
            'salesman_name' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_phone,salesman_wechat,salesman_duty,contract|between:1,20',
            'salesman_phone' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_wechat,salesman_duty,contract',
            'salesman_wechat' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_duty,contract',
            'salesman_duty' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,contract|between:1,30',
            'contract' => 'required_without_all:name,logo,regtime,country,state_id,county_id,zip_id,address,introduction,business,brokerage,web_url,legal_person,salesman_name,salesman_phone,salesman_wechat,salesman_duty'
        ];
    }
}